package com.wing.order.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 产品库存变动记录
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("cab_inventory_product_record")
public class CabInventoryProductRecord extends BaseEntity<CabInventoryProductRecord> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Type implements IEnum<Integer> {
        in4Real(0,"入库"),
        /**
        * 入库
        */
        in(1,"入库"),
        /**
        * 出库
        */
        out(2,"出库"),
        out4Real(3,"出库");



        private int code;
        private String desc;

        Type(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 产品库存主表id
     */
    private Long inventoryProductId;

    /**
     * 出/入库计划id
     */
    private Long planId;

    /**
     * 出/入库作业单id
     */
    private Long jobId;

    /**
     * sku id
     */
    private Long skuId;

    /**
     * skuCode
     */
    private String skuCode;

    /**
     * 仓库id
     */
    private Long warehouseId;

    /**
     * 出入库类型
     */
    private Type type;

    /**
    * 出入库类型描述
    */
    @TableField(exist = false)
    private String typeDesc;

    public String getTypeDesc() {
        return type == null ? null : type.getDesc();
    }

    /**
     * 出入存数量
     */
    private Integer quantity;

    /**
     * 当前库存
     */
    private Integer quantityCurrent;

    /**
     * 变动后库存
     */
    private Integer quantityAfter;

    /**
     * 企业编码
     */
    private String enterpriseCode;

    /**
     * 最小单位数量,e.g:一包十只，两包，此值为：20
     */
    private Integer quantityPack;

    /**
     * 包装数量，e.g,一包十只，此值为：10
     */
    private Integer quantityPackUnit;

    /**
     * 包装规格id
     */
    private Long packId;

    private String packName;


    private String unitName;

    private Integer quantityPackCurrent;

    private Integer quantityPackAfter;

    /**
     * 出入库类型ID
     */
    private Long warehouseInventoryTypeId;

}
